home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / B-C / C++ FAQ Reference 1.0 / C++ FAQ Reference 1.0.rsrc / TEXT_1937.txt < prev    next >
Encoding:
Text File  |  1993-06-30  |  804 b   |  6 lines

  1. The compiler attempts to save space in the executable by not including the float-to-string format conversion routines unless they are necessary, and sometimes does not recognize some code that does require it. Taking the address of a float in an argument list of a function call seems to trigger it, but taking the address of a float element of a struct may fool the compiler.  A "%f" in a printf/scanf format string doesn't trigger it because format strings aren't examined at compile-time.
  2.  
  3. You can fix it by (1) using <iostream.h> instead of <stdio.h>, or (2) by including the following function definition somewhere in your compilation (but don't call it!):
  4.     static void dummyfloat(float *x) { float y; dummyfloat(&y); }
  5.  
  6. See question on stream I/O for more reasons to use <iostream.h> vs <stdio.h>.